package jmvm.schemes;

import java.awt.Point;
import java.util.ArrayList;

import jmvm.components.*;
import jmvm.gui.GuiLabel;
import jmvm.gui.GuiLine;
import jmvm.gui.GuiScheme;


public class Intr1 {
	
	public static IntToBools IMRBits;
	public static NOT not_prekid, not_PRINS, not_PRCOD, not_PRADR, not_PRINM;
	
	public static RSFF PRINS, PRCOD, PRADR, PRINM, PRINTR1, PRINTR2, PRINTR3, PRINTR4, PRINTR5, PRINTR6, PRINTR7;
	public static REG IMR;
	public static DC DCintr1;
	
	public static OR ORprekid;
	public static AND ANDprekid;
	public static NOT NOTprekid;
	
	public static TSB IMRout;
	
	////////////
	//////////// Grafika
	////////////
	
	public static GuiScheme gui;

	public static GuiScheme getGui() {
		return gui;
	}
	
	public static void gui() {

		GuiLine line; // Pomocna promenljiva
		gui = new GuiScheme("jmvm/jmvm/images/intr1.png");
		
		ArrayList<ArrayList<Point>> sections;
		ArrayList<Point> points;
		
		// 
		// 
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(65,37));
		points.add(new Point(72,37));
		sections.add(points);
		line=new GuiLine(sections,UpravOper.stPRINS());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(280,37));
		points.add(new Point(287,37));
		sections.add(points);
		line=new GuiLine(sections,UpravOper.stPRCOD());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(495,37));
		points.add(new Point(502,37));
		sections.add(points);
		line=new GuiLine(sections,UpravOper.stPRADR());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(65,95));
		points.add(new Point(72,95));
		sections.add(points);
		line=new GuiLine(sections,UpravOper.clPRINS());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(280,95));
		points.add(new Point(287,95));
		sections.add(points);
		line=new GuiLine(sections,UpravOper.clPRCOD());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(495,95));
		points.add(new Point(502,95));
		sections.add(points);
		line=new GuiLine(sections,UpravOper.clPRADR());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(136,37));
		points.add(new Point(145,37));
		sections.add(points);
		line=new GuiLine(sections,PRINS.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(351,37));
		points.add(new Point(358,37));
		sections.add(points);
		line=new GuiLine(sections,PRCOD.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(565,37));
		points.add(new Point(573,37));
		sections.add(points);
		line=new GuiLine(sections,PRADR.getOut(0));
		gui.addLine(line);

		//
		//
		// 
		// 
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(65,182));
		points.add(new Point(72,182));
		sections.add(points);
		line=new GuiLine(sections,new Pin(false));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(136,182));
		points.add(new Point(143,182));
		sections.add(points);
		line=new GuiLine(sections,PRINM.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(65,240));
		points.add(new Point(72,240));
		sections.add(points);
		line=new GuiLine(sections,UpravOper.clPRINM());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(65,347));
		points.add(new Point(72,347));
		sections.add(points);
		line=new GuiLine(sections,new Pin(false));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(280,347));
		points.add(new Point(287,347));
		sections.add(points);
		line=new GuiLine(sections,new Pin(false));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(494,347));
		points.add(new Point(503,347));
		sections.add(points);
		line=new GuiLine(sections,new Pin(false));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(65,472));
		points.add(new Point(72,472));
		sections.add(points);
		line=new GuiLine(sections,new Pin(false));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(280,472));
		points.add(new Point(287,472));
		sections.add(points);
		line=new GuiLine(sections,new Pin(false));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(493,472));
		points.add(new Point(503,472));
		sections.add(points);
		line=new GuiLine(sections,new Pin(false));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(493,596));
		points.add(new Point(503,596));
		sections.add(points);
		line=new GuiLine(sections,new Pin(false));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(136,347));
		points.add(new Point(143,347));
		sections.add(points);
		line=new GuiLine(sections,PRINTR1.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(351,347));
		points.add(new Point(358,347));
		sections.add(points);
		line=new GuiLine(sections,PRINTR2.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(136,472));
		points.add(new Point(145,472));
		sections.add(points);
		line=new GuiLine(sections,PRINTR6.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(351,472));
		points.add(new Point(358,472));
		sections.add(points);
		line=new GuiLine(sections,PRINTR5.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(566,347));
		points.add(new Point(573,347));
		sections.add(points);
		line=new GuiLine(sections,PRINTR1.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(565,472));
		points.add(new Point(574,472));
		sections.add(points);
		line=new GuiLine(sections,PRINTR4.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(65,406));
		points.add(new Point(72,406));
		sections.add(points);
		line=new GuiLine(sections,DCintr1.getOut(3));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(279,406));
		points.add(new Point(287,406));
		sections.add(points);
		line=new GuiLine(sections,DCintr1.getOut(2));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(64,530));
		points.add(new Point(73,530));
		sections.add(points);
		line=new GuiLine(sections,DCintr1.getOut(6));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(280,530));
		points.add(new Point(288,530));
		sections.add(points);
		line=new GuiLine(sections,DCintr1.getOut(5));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(495,530));
		points.add(new Point(503,530));
		sections.add(points);
		line=new GuiLine(sections,DCintr1.getOut(4));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(495,654));
		points.add(new Point(502,654));
		sections.add(points);
		line=new GuiLine(sections,DCintr1.getOut(7));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(566,596));
		points.add(new Point(573,596));
		sections.add(points);
		line=new GuiLine(sections,PRINTR7.getOut(0));
		gui.addLine(line);

		//
		//
		
		// 
		// 
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(593,253));
		points.add(new Point(589,130));
		points.add(new Point(589,130));
		points.add(new Point(588,130));
		points.add(new Point(588,296));
		points.add(new Point(590,296));
		points.add(new Point(590,130));
		sections.add(points);
		line=new GuiLine(sections,Bus.IBUS());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(389,191));
		points.add(new Point(389,167));
		points.add(new Point(588,167));
		sections.add(points);
		line=new GuiLine(sections,Bus.IBUS());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(389,235));
		points.add(new Point(389,263));
		points.add(new Point(482,263));
		sections.add(points);
		line=new GuiLine(sections,IMR.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(508,263));
		points.add(new Point(588,263));
		sections.add(points);
		line=new GuiLine(sections,IMRout.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(495,276));
		points.add(new Point(495,269));
		sections.add(points);
		line=new GuiLine(sections,UpravOper.IMRout());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(284,636));
		points.add(new Point(292,636));
		sections.add(points);
		line=new GuiLine(sections,Intr2.prl2());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(284,652));
		points.add(new Point(292,652));
		sections.add(points);
		line=new GuiLine(sections,Intr2.prl1());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(284,669));
		points.add(new Point(292,669));
		sections.add(points);
		line=new GuiLine(sections,Intr2.prl0());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(350,594));
		points.add(new Point(358,594));
		sections.add(points);
		line=new GuiLine(sections,DCintr1.getOut(7));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(351,611));
		points.add(new Point(358,611));
		sections.add(points);
		line=new GuiLine(sections,DCintr1.getOut(6));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(351,627));
		points.add(new Point(358,627));
		sections.add(points);
		line=new GuiLine(sections,DCintr1.getOut(5));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(351,644));
		points.add(new Point(359,644));
		sections.add(points);
		line=new GuiLine(sections,DCintr1.getOut(4));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(351,660));
		points.add(new Point(359,660));
		sections.add(points);
		line=new GuiLine(sections,DCintr1.getOut(3));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(351,677));
		points.add(new Point(359,677));
		sections.add(points);
		line=new GuiLine(sections,DCintr1.getOut(2));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(351,694));
		points.add(new Point(358,694));
		sections.add(points);
		line=new GuiLine(sections,DCintr1.getOut(1));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(351,710));
		points.add(new Point(359,710));
		sections.add(points);
		line=new GuiLine(sections,DCintr1.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(322,736));
		points.add(new Point(322,728));
		sections.add(points);
		line=new GuiLine(sections,UpravOper.clINTR());
		gui.addLine(line);

		//
		//
		
		// 
		// 
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(118,590));
		points.add(new Point(131,590));
		points.add(new Point(131,611));
		points.add(new Point(134,611));
		sections.add(points);
		line=new GuiLine(sections,PRINS.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(119,607));
		points.add(new Point(127,607));
		points.add(new Point(127,619));
		points.add(new Point(134,619));
		sections.add(points);
		line=new GuiLine(sections,PRCOD.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(119,623));
		points.add(new Point(123,623));
		points.add(new Point(123,628));
		points.add(new Point(136,628));
		sections.add(points);
		line=new GuiLine(sections,PRADR.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(118,640));
		points.add(new Point(123,640));
		points.add(new Point(123,637));
		points.add(new Point(136,637));
		sections.add(points);
		line=new GuiLine(sections,PRINM.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(118,656));
		points.add(new Point(126,656));
		points.add(new Point(126,644));
		points.add(new Point(134,644));
		sections.add(points);
		line=new GuiLine(sections,Intr2.printr());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(120,696));
		points.add(new Point(131,696));
		points.add(new Point(131,652));
		points.add(new Point(134,652));
		sections.add(points);
		line=new GuiLine(sections,ANDprekid.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(160,632));
		points.add(new Point(167,632));
		sections.add(points);
		line=new GuiLine(sections,ORprekid.getOut(0));
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(86,689));
		points.add(new Point(93,689));
		sections.add(points);
		line=new GuiLine(sections,Exec2.PSWT());
		gui.addLine(line);

		//
		//
		sections=new ArrayList<ArrayList<Point>>();
		points=new ArrayList<Point>();
		points.add(new Point(86,702));
		points.add(new Point(93,702));
		sections.add(points);
		line=new GuiLine(sections,NOTprekid.getOut(0));
		gui.addLine(line);

		//
		//
		
		gui.addLabel(new GuiLabel(377, 276, IMR.getOut(0)));
		gui.addLabel(new GuiLabel(595, 222, Bus.IBUS()));




		
		
	}
	/////////////
	/////////////
	/////////////
	
	public static void init() {

		/////
		IMRBits = new IntToBools(16, 16);
		not_prekid = new NOT();
		not_PRINS = new NOT(); 
		not_PRCOD = new NOT(); 
		not_PRADR = new NOT(); 
		not_PRINM = new NOT();
		/////
		
		PRINS = new RSFF("PRINS");
		PRINS.setPinE(new Pin(true));
		PRINS.setPinClear(new Pin(false));

		PRCOD = new RSFF("PRCOD");
		PRCOD.setPinE(new Pin(true));
		PRCOD.setPinClear(new Pin(false));

		PRADR = new RSFF("PRADR");
		PRADR.setPinE(new Pin(true));
		PRADR.setPinClear(new Pin(false));

		PRINM = new RSFF("PRINM");
		PRINM.setPinE(new Pin(true));
		PRINM.setPinClear(new Pin(false));

		PRINTR1 = new RSFF("PRINTR1");
		PRINTR1.setPinE(new Pin(true));
		PRINTR1.setPinClear(new Pin(false));

		PRINTR2 = new RSFF("PRINTR2");
		PRINTR2.setPinE(new Pin(true));
		PRINTR2.setPinClear(new Pin(false));

		PRINTR3 = new RSFF("PRINTR3");
		PRINTR3.setPinE(new Pin(true));
		PRINTR3.setPinClear(new Pin(false));
		
		PRINTR4 = new RSFF("PRINTR4");
		PRINTR4.setPinE(new Pin(true));
		PRINTR4.setPinClear(new Pin(false));

		PRINTR5 = new RSFF("PRINTR5");
		PRINTR5.setPinE(new Pin(true));
		PRINTR5.setPinClear(new Pin(false));

		PRINTR6 = new RSFF("PRINTR6");
		PRINTR6.setPinE(new Pin(true));
		PRINTR6.setPinClear(new Pin(false));
		
		PRINTR7 = new RSFF("PRINTR7");
		PRINTR7.setPinE(new Pin(true));
		PRINTR7.setPinClear(new Pin(false));

		IMR = new REG(1, "IMR");
		IMR.getOut(0).setIsInt();
		IMR.getOut(0).setNumOfLines(16);
		IMR.initVal(15); // DOZVOLI MASKIRAJUCI SVE PREKIDE
		
		DCintr1 = new DC(3);

		ORprekid = new OR(6);
		NOTprekid = new NOT();
		ANDprekid = new AND();	

		IMRout = new TSB();
		IMRout.getOut(0).setNumOfLines(16);

	}
	
	public static void connect() {
		
		//////
		IMRBits.setInputPin(0, IMR.getOut(0));
		not_prekid.setInputPin(0, ORprekid.getOut(0));
		not_PRINS.setInputPin(0, PRINS.getOut(0));
		not_PRCOD.setInputPin(0, PRCOD.getOut(0));
		not_PRADR.setInputPin(0, PRADR.getOut(0));
		not_PRINM.setInputPin(0, PRINM.getOut(0));
		//////
		
		PRINS.setInputPin(0, UpravOper.stPRINS());
		PRINS.setInputPin(1, UpravOper.clPRINS());

		PRCOD.setInputPin(0, UpravOper.stPRCOD());
		PRCOD.setInputPin(1, UpravOper.clPRCOD());

		PRADR.setInputPin(0, UpravOper.stPRADR());
		PRADR.setInputPin(1, UpravOper.clPRADR());

		PRINM.setInputPin(0, new Pin(false));// odakle dovuci ovaj INM->Fixirati Pin sa False
		PRINM.setInputPin(1, UpravOper.clPRINM());

		PRINTR1.setInputPin(0, new Pin(false));			// treba li U/I ?????????????
		PRINTR1.setInputPin(1, DCintr1.getOut(1));

		PRINTR2.setInputPin(0, new Pin(false)); 		// treba li U/I ?????????????
		PRINTR2.setInputPin(1, DCintr1.getOut(2));

		PRINTR3.setInputPin(0, new Pin(false));			// treba li U/I ?????????????
		PRINTR3.setInputPin(1, DCintr1.getOut(3));
		
		PRINTR4.setInputPin(0, new Pin(false));			// treba li U/I ?????????????
		PRINTR4.setInputPin(1, DCintr1.getOut(4));

		PRINTR5.setInputPin(0, new Pin(false));			// treba li U/I ?????????????
		PRINTR5.setInputPin(1, DCintr1.getOut(5));

		PRINTR6.setInputPin(0, new Pin(false));			// treba li U/I ?????????????
		PRINTR6.setInputPin(1, DCintr1.getOut(6));
		
		PRINTR7.setInputPin(0, new Pin(false));			// treba li U/I ?????????????
		PRINTR7.setInputPin(1, DCintr1.getOut(7));

		IMR.setInputPin(0, Bus.IBUS());
		IMR.setPinLd(UpravOper.ldIMR());
		
		DCintr1.setE(UpravOper.clINTR());
		DCintr1.setInputPin(0, Intr2.prl0());
		DCintr1.setInputPin(1, Intr2.prl1());
		DCintr1.setInputPin(2, Intr2.prl2());
		
		NOTprekid.setInputPin(0, Fetch2.RTI());
		ANDprekid.setInputPin(0, Exec2.PSWT());
		ANDprekid.setInputPin(1, NOTprekid.getOut(0));

		ORprekid.setInputPin(0, PRINS.getOut(0));
		ORprekid.setInputPin(1, PRCOD.getOut(0));
		ORprekid.setInputPin(2, PRADR.getOut(0));
		ORprekid.setInputPin(3, PRINM.getOut(0));
		ORprekid.setInputPin(4, Intr2.printr());
		ORprekid.setInputPin(5, ANDprekid.getOut(0));
		
		IMRout.setInputPin(0, IMR.getOut(0));
		IMRout.setCtrl(UpravOper.IMRout());
		Bus.addOnIBUS(IMRout.getOut(0));
	}
	
	public static Pin IMR1() {
		return IMRBits.getOut(1);
	}

	public static Pin IMR2() {
		return IMRBits.getOut(2);
	}

	public static Pin IMR3() {
		return IMRBits.getOut(3);
	}
		
	public static Pin IMR4() {
		return IMRBits.getOut(4);
	}

	public static Pin IMR5() {
		return IMRBits.getOut(5);
	}

	public static Pin IMR6() {
		return IMRBits.getOut(6);
	}
	
	public static Pin IMR7() {
		return IMRBits.getOut(7);
	}
	
	public static Pin prekid() {
		return ORprekid.getOut(0);
	}

	public static Pin PRINS() {
		return PRINS.getOut(0);
	}

	public static Pin PRCOD() {
		return PRCOD.getOut(0);
	}

	public static Pin PRADR() {
		return PRADR.getOut(0);
	}

	public static Pin PRINM() {
		return PRINM.getOut(0);
	}

	public static Pin PRINTR1() {
		return PRINTR1.getOut(0);
	}

	public static Pin PRINTR2() {
		return PRINTR2.getOut(0);
	}

	public static Pin PRINTR3() {
		return PRINTR3.getOut(0);
	}
	
	public static Pin PRINTR4() {
		return PRINTR4.getOut(0);
	}

	public static Pin PRINTR5() {
		return PRINTR5.getOut(0);
	}

	public static Pin PRINTR6() {
		return PRINTR6.getOut(0);
	}
	
	public static Pin PRINTR7() {
		return PRINTR7.getOut(0);
	}
	
	public static Pin not_prekid() {
		return not_prekid.getOut(0);
	}
	
	public static Pin not_PRINS() {
		return not_PRINS.getOut(0);
	}
	
	public static Pin not_PRCOD() {
		return not_PRCOD.getOut(0);
	}
	
	public static Pin not_PRADR() {
		return not_PRADR.getOut(0);
	}
	
	public static Pin not_PRINM() {
		return not_PRINM.getOut(0);
	}
	
	// RSFF PRINS, PRCOD, PRADR, PRINM, PRINTR1, PRINTR2, PRINTR3, PRINTR4, PRINTR5, PRINTR6, PRINTR7;
	public static void ispisiFlegove() {
		System.out.println("\n Registar IMR = " + IMR.getOut(0).getIntVal() );
		System.out.println("\n Flegovi u Intr:" + " PRINS=" + PRINS.getOut(0).getBoolVal() + " PRCOD=" + PRCOD.getOut(0).getBoolVal() + " PRADR=" + PRADR.getOut(0).getBoolVal() 
				+ " PRINM=" + PRINM.getOut(0).getBoolVal() + " PRINTR1=" + PRINTR1.getOut(0).getBoolVal() + " PRINTR2=" + PRINTR2.getOut(0).getBoolVal() + " PRINTR3=" + PRINTR3.getOut(0).getBoolVal() 
				+ " PRINTR4=" + PRINTR4.getOut(0).getBoolVal() + " PRINTR5=" + PRINTR5.getOut(0).getBoolVal() + " PRINTR6=" + PRINTR6.getOut(0).getBoolVal() + " PRINTR7=" + PRINTR7.getOut(0).getBoolVal() );
	}

}
